<template >
  <div class="container">
    <van-nav-bar
      title="我的预约"
      left-text="返回"
      style="background-color: #f4b4b6"
      left-arrow
      @click-left="onClickLeft"
    />
    <div class="content">
      <div class="roundRecord">
        <div class="roundSmall">
          <div v-if="statusObj.status === 'progress'">正在进行中...</div>
          <div v-else-if="statusObj.status === 'Finish'">已完成</div>
          <div v-else-if="statusObj.status === 'cancel'">已取消</div>
        </div>
      </div>
    </div>
    <div class="infoCard">
      <div><span>教练名字：</span><span><van-tag size="medium" type="primary">{{coachNickName}}</van-tag></span></div>
      <div><span>教练电话：</span><span><van-tag  size="medium" type="primary">{{statusObj.telephone}}</van-tag></span></div>
      <div><span>预约时间段：</span><span>
        <van-tag v-if="statusObj.attendTime === 'Eight'"  size="medium" type="primary">8:00~10:00</van-tag>
        <van-tag v-if="statusObj.attendTime === 'ten'"  size="medium" type="primary">10:00~12:00</van-tag>
        <van-tag v-if="statusObj.attendTime === 'twelve'"  size="medium" type="primary">12:00~14:00</van-tag>
        <van-tag v-if="statusObj.attendTime === 'fourteen'"  size="medium" type="primary">14:00~16:00</van-tag>
        <van-tag v-if="statusObj.attendTime === 'sixteen'"  size="medium" type="primary">16:00~18:00</van-tag>
        </span></div>
    </div>
    <div class="background">
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
      <span></span>
    </div>
  </div>
</template>

<script>
import { Toast } from 'vant';
import chauffeur from "../js/chauffeur";
export default {
  data() {
    return{
      statusObj:{
        attendTime:"",
        catogary:"",
        telephone:"",
        coach:"",
        status:"",
      },
      coachName:"",
      coachNickName:"",
    }
  },
  mounted(){
    this.getTraineeStatus()
  },
  methods:{
    onClickLeft(){
      this.$router.go(-1)
    },
    getTraineeStatus(){
      let nowDate = new Date()
      let newDate = this.getNowFormatDateTime3(nowDate)
      let requestBody = {
        create_time:newDate
      }
      chauffeur.getTraineeStatus(requestBody).then(res =>{
        if(res.data.code === 0){
          this.statusObj = res.data.data.list[0]
          chauffeur.getUserDeilById(this.statusObj.coach).then(res => {
            this.coachName = res.data.data.username
            this.coachNickName = res.data.data.nickname
          })
        }else{
          Toast.fail('未知错误');
        }
      })
    },
    getNowFormatDateTime3:(date)=>{//获取后一天日期
        let time = ''
        if(date){
            time=new Date(date).getTime()+24*60*60*1000;
        }else{
            time=new Date().getTime()+24*60*60*1000;
        }
        let afterday=new Date(time);
        return afterday=afterday.getFullYear() + "-" + (afterday.getMonth()> 9 ? (afterday.getMonth() + 1) :  + (afterday.getMonth() + 1)) + "-" +(afterday.getDate()> 9 ? (afterday.getDate()) : "0" + (afterday.getDate()));
    },
  }
}
</script>

<style scoped lang="less">
.container{
  .content{
    z-index: 99;
    height: 80vh;
    position: relative;
    .roundRecord{
      filter: drop-shadow(2px 4px 8px #2cb5ac);
      width: 150px;
      height: 150px;
      border-radius: 50%;
      border: 1px solid #2cb5ac;
      position: absolute;
      top: 50%;
      left: 50%;
      margin-left: -75px;
      margin-top: -75px;
      animation: change 5s linear infinite;
      display: flex;
      justify-content: center;
      align-items: center;
      .roundSmall{
        filter: drop-shadow(2px 4px 8px #2cb5ac);
        width: 75px;
        height: 75px;
        border-radius: 50%;
        border: 1px solid #2cb5ac;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
        div{
          filter: drop-shadow(2px 4px 8px #2cb5ac);
          color: #2cb5ac;
        }
      }
    }
  }
  .infoCard{
    width: 300px;
    height: 200px;
    border-radius: 5px;
    z-index: 99;
    position: absolute;
    top: 65%;
    left: 15%;
    div{
      font-size: 1.25rem;
       color: #2cb5ac;
    }
  }
  @keyframes move {
    100% {
        transform: translate3d(0, 0, 1px) rotate(360deg);
    }
}

.background {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    background: #3E1E68;
    overflow: hidden;
}

.background span {
    width: 20vmin;
    height: 20vmin;
    border-radius: 20vmin;
    backface-visibility: hidden;
    position: absolute;
    animation: move;
    animation-duration: 45;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
}

.background span:nth-child(0) {
    color: #FFACAC;
    top: 48%;
    left: 7%;
    animation-duration: 31s;
    animation-delay: -42s;
    transform-origin: 4vw -12vh;
    box-shadow: -40vmin 0 5.145388791853863vmin currentColor;
}
.background span:nth-child(1) {
    color: #FFACAC;
    top: 62%;
    left: 86%;
    animation-duration: 13s;
    animation-delay: -12s;
    transform-origin: -7vw -17vh;
    box-shadow: -40vmin 0 5.180570050197764vmin currentColor;
}
.background span:nth-child(2) {
    color: #FFACAC;
    top: 70%;
    left: 21%;
    animation-duration: 8s;
    animation-delay: -47s;
    transform-origin: 5vw 6vh;
    box-shadow: 40vmin 0 5.464056909041385vmin currentColor;
}
.background span:nth-child(3) {
    color: #583C87;
    top: 89%;
    left: 81%;
    animation-duration: 42s;
    animation-delay: -5s;
    transform-origin: 24vw 9vh;
    box-shadow: -40vmin 0 5.3711727876495665vmin currentColor;
}
.background span:nth-child(4) {
    color: #E45A84;
    top: 37%;
    left: 94%;
    animation-duration: 44s;
    animation-delay: -26s;
    transform-origin: -8vw -15vh;
    box-shadow: -40vmin 0 5.445569407164664vmin currentColor;
}
.background span:nth-child(5) {
    color: #E45A84;
    top: 74%;
    left: 87%;
    animation-duration: 42s;
    animation-delay: -14s;
    transform-origin: -19vw 9vh;
    box-shadow: -40vmin 0 5.829598832321179vmin currentColor;
}
.background span:nth-child(6) {
    color: #583C87;
    top: 93%;
    left: 46%;
    animation-duration: 45s;
    animation-delay: -44s;
    transform-origin: -15vw 17vh;
    box-shadow: 40vmin 0 5.712829990251526vmin currentColor;
}
.background span:nth-child(7) {
    color: #583C87;
    top: 50%;
    left: 43%;
    animation-duration: 27s;
    animation-delay: -47s;
    transform-origin: -5vw 20vh;
    box-shadow: 40vmin 0 5.937614973242449vmin currentColor;
}
.background span:nth-child(8) {
    color: #E45A84;
    top: 99%;
    left: 52%;
    animation-duration: 12s;
    animation-delay: -33s;
    transform-origin: -17vw -23vh;
    box-shadow: -40vmin 0 5.27343647554498vmin currentColor;
}
.background span:nth-child(9) {
    color: #583C87;
    top: 19%;
    left: 53%;
    animation-duration: 42s;
    animation-delay: -41s;
    transform-origin: -4vw 0vh;
    box-shadow: -40vmin 0 5.712649777654546vmin currentColor;
}
.background span:nth-child(10) {
    color: #583C87;
    top: 28%;
    left: 68%;
    animation-duration: 6s;
    animation-delay: -22s;
    transform-origin: 0vw 23vh;
    box-shadow: 40vmin 0 5.830085200145943vmin currentColor;
}
.background span:nth-child(11) {
    color: #E45A84;
    top: 12%;
    left: 61%;
    animation-duration: 22s;
    animation-delay: -45s;
    transform-origin: -21vw -13vh;
    box-shadow: -40vmin 0 5.014640469753686vmin currentColor;
}
.background span:nth-child(12) {
    color: #583C87;
    top: 30%;
    left: 3%;
    animation-duration: 52s;
    animation-delay: -32s;
    transform-origin: -16vw 1vh;
    box-shadow: 40vmin 0 5.897191797876468vmin currentColor;
}
.background span:nth-child(13) {
    color: #E45A84;
    top: 10%;
    left: 49%;
    animation-duration: 35s;
    animation-delay: -49s;
    transform-origin: 15vw -19vh;
    box-shadow: -40vmin 0 5.083258004687777vmin currentColor;
}
.background span:nth-child(14) {
    color: #583C87;
    top: 4%;
    left: 59%;
    animation-duration: 22s;
    animation-delay: -28s;
    transform-origin: 22vw -18vh;
    box-shadow: -40vmin 0 5.867072007329089vmin currentColor;
}
.background span:nth-child(15) {
    color: #583C87;
    top: 47%;
    left: 94%;
    animation-duration: 35s;
    animation-delay: -48s;
    transform-origin: -24vw -23vh;
    box-shadow: 40vmin 0 5.161121151768261vmin currentColor;
}
.background span:nth-child(16) {
    color: #FFACAC;
    top: 66%;
    left: 8%;
    animation-duration: 54s;
    animation-delay: -48s;
    transform-origin: -16vw -3vh;
    box-shadow: -40vmin 0 5.55288717542763vmin currentColor;
}
.background span:nth-child(17) {
    color: #FFACAC;
    top: 50%;
    left: 11%;
    animation-duration: 22s;
    animation-delay: -22s;
    transform-origin: 23vw 13vh;
    box-shadow: 40vmin 0 5.615544419490285vmin currentColor;
}
.background span:nth-child(18) {
    color: #E45A84;
    top: 12%;
    left: 32%;
    animation-duration: 29s;
    animation-delay: -18s;
    transform-origin: -20vw 17vh;
    box-shadow: 40vmin 0 5.058134051665996vmin currentColor;
}
.background span:nth-child(19) {
    color: #FFACAC;
    top: 90%;
    left: 11%;
    animation-duration: 10s;
    animation-delay: -42s;
    transform-origin: -18vw 5vh;
    box-shadow: 40vmin 0 5.780525481833499vmin currentColor;
}
}
@keyframes change{
  0%{
    transform: scale(1);
  }25%{
    transform: scale(1.5);
  }50%{
    transform: scale(2);
  }75%{
    transform: scale(1.5);
  }100%{
    transform: scale(1);
  }
}
 /deep/ .van-nav-bar__title {
    color: #fff;
  }

  /deep/ .van-nav-bar__text {
    color: #fff;
  }

  /deep/ .van-icon-arrow-left {
    color: #fff;
  }
</style>